<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>礼品规则的审核</title>
		<script language="javascript" src="../script/common.js"></script>
		<!--动态js-->
		<script language="javascript">
		var orgs = Common.cOrg();	//当前单位
		var num=0;
		var qtlist={};
		var giftRuleList=[{code:"通过",text:"通过"},{code:"不通过",text:"不通过"}]
		function load(){
			Eui.showNavigation();
			$("search").orgn.value=orgs.id;
		     Common.initDict("idear",giftRuleList);
			Common.initDict(crelistform1.hqCheckState, "track_checkstate", "请选择");
			Common.initDict(crelistform1.areaCheckState, "track_checkstate", "请选择");
			Common.initDict(search.status, "apply_checkstate", "全部");
			Common.initDict(search.accLevel, "customer_level", "全部");
			setPages(["detview","listview2"])
			createTable();
		}
		function xiugaiFunc(v,r){
		if(r[0]=="等待审核"){
		return "<a href=# onclick=\"onEdit('"+r[0]+"','"+r[1]+"','"+r[2]+"','"+r[3]+"','"+r[4]+"','"+r[5]+"','"+r[6]+"');return false;\">审核</a>"
		}else{
		return "<a href=# onclick=\"onEdit('"+r[0]+"','"+r[1]+"','"+r[2]+"','"+r[3]+"','"+r[4]+"','"+r[5]+"','"+r[6]+"');return false;\">查看</a>"
		}
			
		}
		function createTable(){
		   
			var columns = [];
			columns[4]={title:"操作",width:"6%",render:xiugaiFunc}
			qt = new QueryTable("loy_rule_confirm","search","datalist",columns);				
			switchPage("listview2");
		}
		
		function createTableList(){
			var columns = [];
			qtlist = new QueryTable("loy_rule_confirmlist","crelistform","dlist",columns);				
		}			
		//显示、刷新表格
		function showData(){
			qt.showTable();
		}
		function showDataList(){
			qtlist.showTable();
		}
		function setOrg1(sorg){
		}
		function onEdit(state,varValue,time,oper,orgg,actid,id){
		   if(state=="审核结束"){
		    $('pp').style.display = "none";
		    }
		 $('listview').style.display = "none";
		     $('detview').style.display = "";
		     $("states").innerHTML=state;
		     $("sendtime").innerHTML=time;
		     $("varValue").innerHTML=varValue;	
		     $("sendoper").innerHTML=oper;	
			$("sendorg").innerHTML=orgg;	
			$("crelistform").act.value=actid;
			$("crelistform").checkflowid.value=id;
		     createTableList();
		     showDataList();
			switchPage("detview");
		}
		function back(){
		switchPage("detview");
		}
		function onSave(){
		var comments=$("crelistform1").comments.value;
		var varVal=$("crelistform1").idear.value;
		var checkflowid=$("crelistform").checkflowid.value;
		DWR.call('giftProjectService.checkGiftRule',checkflowid,varVal,comments,function(v){
		    showInformation("审核完毕!");
		    $('listview').style.display = "";
		     createTable();
          	switchPage('listview2');
		   });	
		}
		function Cancla(){
			$('listview').style.display = "";
			createTable();
			qt.showTable();
			switchPage('listview2');
		}
		
	  function   validateTextCounter(obj,maxlimit){ 
        var   maxlimit=80; 
        if   (obj.value.length > maxlimit){ 
         alert( "最多只能输入80个字符 "); 
         obj.value = obj.value.substring(0,maxlimit); 
          } 
       } 
		</script>
	</head>
<body onload="load()">
	<div class="nav"><div id="nav">&nbsp;</div></div>
	<div id="content">
		<div id="listview" >	
			<div class="searchForm">
				<form id="search" name="search">
					<input type=hidden id="orgn" name="orgn">
					<table cellSpacing=0 cellPadding=4 width="100%" border=0>
						<tr>
						    <td><label>审核状态</label> <select name="status"></select></td>
							<td><button type="button" onclick="showData()">查 询</button></td>
						</tr>
					</table>
				</form>
			</div>
		</div>
		<div id="listview2" style='display:none;'>
			<div id=datalist></div>
	    </div>
		<!--明细(新增)静态页面部分-->
		<div id=detview style='display:none;' align=center>
			<form id='crelistform' name='crelistform' method='POST' enctype='multipart/form-data' action='/upload/pic/'>
				<input type=hidden id=act name=act>
					<input type=hidden id=checkflowid name=checkflowid>
				<div class=form>
				<div class="formTitle">规则信息</div>
					<table cellSpacing=0 cellPadding=4 width="100%" border=0 class="col3 label6">
						<tr>
							<td><label>审核状态</label> <span id="states"></span></td>
							<td><label>审核意见</label> <span id="varValue"></span></td>
							
						</tr>
						<tr>
						<td><label>提交日期</label> <span id="sendtime"></span></td>
						<td><label>操作员</label> <span id="sendoper"></span></td>
						</tr>
						<tr>
							<td><label>提交机构</label> <span id="sendorg"></span></td>
						</tr>	
					</table>
				</div>
			</form>
		
		     <div id="dlist"></div>
		     	<form id='crelistform1' name='crelistform1' method='POST'
	                     enctype='multipart/form-data' action='/upload/pic/'>
                            <div class=form name=pp id=pp align=center>
                             <table cellSpacing=0 cellPadding=5 width="100%" border=0
	                   class="col3 label6">
                      <tr>
	<td><label>审核意见</label>
	<select name="idear" onblur="checkV(this,'',true)"></select><font color="red">&nbsp;*</font><button type="button" onclick="onSave()" align="center">审核确认</button>
	</td>	
	
	<tr>
     <td><label>反馈意见</label><textarea name="comments" cols="80" rows="4" id="comments"  onkeyup= " validateTextCounter(this); "   onchange= " validateTextCounter(this); "> </textarea></td>
	
	</tr>
	
</tr>
</table>

</div>

</form>
<button type="button" onclick="Cancla()">返回</button>
		</div>
	</div>
</div>
</body>
</html>